$OpenBSD: patch-utils_deriveConstants_DeriveConstants_hs,v 1.1 2014/11/22 20:23:23 kili Exp $

Our nm(1) doesn't have -P and doesn't print sizes, so use objdump(1) instead
and adjust the "parser".

And just after few hours after fixing it this way, I noticed this one:

http://ghc.haskell.org/trac/ghc/changeset/2cc206505d248ac8c706aa85342a895857c9f091/ghc

So this patch can be removed for the next ghc release (8.0?).

--- utils/deriveConstants/DeriveConstants.hs.orig	Thu Jul 10 06:27:17 2014
+++ utils/deriveConstants/DeriveConstants.hs	Mon Nov  3 16:48:29 2014
@@ -638,7 +638,7 @@ getWanted verbose tmpdir gccProgram gccFlags nmProgram
              oFile = tmpdir </> "tmp.o"
          writeFile cFile cStuff
          execute verbose gccProgram (gccFlags ++ ["-c", cFile, "-o", oFile])
-         xs <- readProcess nmProgram ["-P", oFile] ""
+         xs <- readProcess "objdump" ["-t", oFile] ""
          let ls = lines xs
              ms = map parseNmLine ls
              m = Map.fromList $ catMaybes ms
@@ -715,9 +715,7 @@ getWanted verbose tmpdir gccProgram gccFlags nmProgram
           -- and returns ("MAX_Vanilla_REG", 11)
           parseNmLine line
               = case words line of
-                ('_' : n) : "C" : s : _ -> mkP n s
-                n : "C" : s : _ -> mkP n s
-                [n, "D", _, s] -> mkP n s
+		[s, _, "*COM*", _, n] -> mkP n s
                 _ -> Nothing
               where mkP r s = case (stripPrefix prefix r, readHex s) of
                         (Just name, [(size, "")]) -> Just (name, size)
